/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */

package entity;

import java.io.Serializable;
import javax.persistence.Basic;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.Table;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Size;
import javax.xml.bind.annotation.XmlRootElement;

/**
 *
 * @author Rodrigo
 */
@Entity
@Table(name = "item_evaluacion")
@XmlRootElement
@NamedQueries({
    @NamedQuery(name = "ItemEvaluacion.findAll", query = "SELECT i FROM ItemEvaluacion i"),
    @NamedQuery(name = "ItemEvaluacion.findById", query = "SELECT i FROM ItemEvaluacion i WHERE i.id = :id"),
    @NamedQuery(name = "ItemEvaluacion.findByItem", query = "SELECT i FROM ItemEvaluacion i WHERE i.item = :item"),
    @NamedQuery(name = "ItemEvaluacion.findByPuntaje", query = "SELECT i FROM ItemEvaluacion i WHERE i.puntaje = :puntaje")})
public class ItemEvaluacion implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    @Basic(optional = false)
    @Column(name = "ID")
    private Integer id;
    @Basic(optional = false)
    @NotNull
    @Size(min = 1, max = 512)
    @Column(name = "ITEM")
    private String item;
    @Basic(optional = false)
    @NotNull
    @Column(name = "PUNTAJE")
    private int puntaje;
    @JoinColumn(name = "EVALUACION_CURSO", referencedColumnName = "ID")
    @ManyToOne(optional = false, fetch = FetchType.EAGER)
    private EvaluacionCurso evaluacionCurso;

    public ItemEvaluacion() {
    }

    public ItemEvaluacion(Integer id) {
        this.id = id;
    }

    public ItemEvaluacion(Integer id, String item, int puntaje) {
        this.id = id;
        this.item = item;
        this.puntaje = puntaje;
    }

    public Integer getId() {
        return id;
    }

    public void setId(Integer id) {
        this.id = id;
    }

    public String getItem() {
        return item;
    }

    public void setItem(String item) {
        this.item = item;
    }

    public int getPuntaje() {
        return puntaje;
    }

    public void setPuntaje(int puntaje) {
        this.puntaje = puntaje;
    }

    public EvaluacionCurso getEvaluacionCurso() {
        return evaluacionCurso;
    }

    public void setEvaluacionCurso(EvaluacionCurso evaluacionCurso) {
        this.evaluacionCurso = evaluacionCurso;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (id != null ? id.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof ItemEvaluacion)) {
            return false;
        }
        ItemEvaluacion other = (ItemEvaluacion) object;
        if ((this.id == null && other.id != null) || (this.id != null && !this.id.equals(other.id))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "entity.ItemEvaluacion[ id=" + id + " ]";
    }
    
}
